home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 June / CHIP Haziran 2001.iso / prog / share / 04 / setup.exe / MM6.Cab / F1625_BrwsrSwtch.scpt.F6A680DD_F3FB_4CF3_BABB_0D0F06E630F5 < prev    next >
Text File  |  2000-08-17  |  1KB  |  45 lines

  1. function CSBrowserSwitch(action) {
  2.     var bAgent    = window.navigator.userAgent;
  3.     var bAppName    = window.navigator.appName;
  4.  
  5.     var isNS        = (bAppName.indexOf("Netscape") >= 0);
  6.     var isIE        = (bAppName.indexOf("Explorer") >= 0);
  7.     var isWin        = (bAgent.indexOf("Win") >= 0); 
  8.     var isMac        = (bAgent.indexOf("Mac") >= 0); 
  9.  
  10.     var vers        = 0;
  11.     var versIdx    = (bAgent.indexOf("Mozilla/"));
  12.  
  13.     if(versIdx >= 0)
  14.         {
  15.         var sstr    = bAgent.substring(versIdx + 8, versIdx + 9);
  16.         vers        = parseInt(sstr) - 2;
  17.         }
  18.  
  19.     var url        = action[1];
  20.     var platform    = action[2];
  21.  
  22.     var versVec;
  23.     if(platform)
  24.         {
  25.         if(isNS && isMac) versVec = action[3];
  26.         if(isIE && isMac) versVec = action[5];
  27.         if(isNS && isWin) versVec = action[4];
  28.         if(isIE && isWin) versVec = action[6];
  29.         }
  30.     else
  31.         {
  32.         if(isNS) versVec = action[3];
  33.         if(isIE) versVec = action[4];
  34.         }
  35.  
  36.     if(vers > (versVec.length-1))
  37.         vers = versVec.length-1;
  38.     if(versVec[vers] == 0)
  39.         {
  40.         location            = url;
  41.         CSStopExecution    = true;    
  42.         }
  43. }
  44.  
  45.